<template>
  <div class="header">
    <span class="back" @click="goBack">
      <img src="@/assets/img/arrow_left.png" alt="" />
    </span>
    <!--头部标题-->
    <slot name="mall-title">
      <span class="headerText" v-if="headerText && headerText.title">{{
        headerText.title
      }}</span>
    </slot>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // title: '头部',
    };
  },
  props: {
    //标题文案
    headerText: {
      type: Object,
      default: function() {
        return {
          title: '',
          rightTitle: '',
          rightTip: false
        };
      }
    }
  },
  methods: {
    goBack: function() {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 90px;
  line-height: 90px;
  position: fixed;
  left: 0;
  top: 0;
  text-align: center;
  background-color: #fff;
  z-index: 990;

  .back {
    display: block;
    float: left;
    width: 80px;
    height: 100%;

    img {
      width: 48px;
      height: 48px;
      margin: 25px 0 0 20px;
    }
  }

  .headerText {
    font-weight: 500;
    font-size: 32px;
    color: rgba(12, 12, 28, 1);
    position: absolute;
    left: 50%;
    top: 0;
    z-index: 9999;
    -webkit-transform: translateX(-50%);
    -moz-transform: translateX(-50%);
    transform: translateX(-50%);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 60%;
    padding-top: 5px;
  }

  .headerRightBtn {
    position: relative;
    float: right;
    padding: 0 20px 0 0;
    color: rgba(12, 12, 28, 0.7);
    font-size: 28px;
    cursor: pointer;

    .dot {
      position: absolute;
      top: 20px;
      width: 10px;
      height: 10px;
      background: red;
      border-radius: 10px;
    }
  }
}
</style>
